<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>innerHTML</title>
		<script>
			function changeH1(){
				let h=document.getElementById("slogon");
				if(h.align!="right")
					h.align="right";
				else
					h.align="left";
				
				h.innerHTML="欢迎访问<a href='https://www.bdqn.cn' target='_blank'>青鸟总部网站</a>";	
				//h.innerText="欢迎访问<a href='https://www.bdqn.cn' target='_blank'>青鸟总部网站</a>";	
			}
			function changeDiv(){
				//let dr=document.getElementsByTagName("div");
				// let dr=document.querySelectorAll("div");
				// for(let i=0;i<dr.length;i++){
				// 	dr[i].innerHTML="躺平不是最好的，肯定最舒服";
				// 	dr[i].style.fontSize="100px";
				// }
				let ar=document.querySelectorAll("div a");
				for(let i=0;i<ar.length;i++){
					ar[i].innerHTML="还是360好"; 
					ar[i].href="https://www.360.cn";
					ar[i].target="_blank";
				}
			}
			function getSeason(){
				//let sr=document.getElementsByName("season");
				let sr=document.querySelectorAll("input[name=season]");
				let str="";
				for (var i = 0; i < sr.length; i++) {
					str+=sr[i].value;
				}
				document.getElementById("s").innerText=str;
			}
			function chngImg(){
				let p=document.getElementById("pic");
				p.src="../images/kongzi.jpg";
				
			}
		</script>
	</head>
	<body>
		<h1 id="slogon">教育改变生活</h1>
		<div>
			We change lives
			<a href="#">ask me</a>
		</div>
		<div>
			You change your lives
			<a href="#">bing</a>
		</div>
		<p>
			<a href="#">baidu</a>
		</p>
		<p>
			<input type="text" name="season" value="春"/>
			<input type="text" name="season" value="夏"/>
			<input type="text" name="season" value="秋"/>
			<input type="text" name="season" value="冬"/>
		</p>
		<p>
			<img src="../images/jixue.jpg" id="pic"/>
			
		</p>
		<input type="button" value="修改h1" onclick="changeH1()"/>
		<input type="button" value="修改div" onclick="changeDiv()"/>
		<input type="button" value="获得四季" onclick="getSeason()"/>
		<input type="button" value="换成孔夫子" onclick="chngImg()"/>
		<label id="s"></label>
	</body>
</html>